For the resource allocation problem of automatic guided vehicle system, which was composed by both task assigning and route scheduling, a model based on the automatic in-put and out-put system of warehouse was built, and the algorithm with the framework of Particle Swarm Optimization (PSO) and the process of conflict-free routing was proposed to overcome the shortages of just assigning the tasks in sequence. Firstly, the iteration processes were used to search for the optimal scheme of assigning task. Then, the conflict-free routing was employed to obtain the result of resource allocation. Some constraints were added into the solution evaluation mechanism, such as time window, workload balance and conflict-free routes to ensure that the final scheme was feasible. Through the simulation of an automatic in-put system, the traditional scheduling algorithm and the new algorithm were compared. The proposed algorithm can save 10% of the total travelling distance and its balance of task assigning is better. It means that the proposed solution can improve the efficiency of whole system.